import java.util.Scanner;

public class Main {
    public static void main(String[] args) {

        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入班级数量：");
        double[][] scores=new double[scanner.nextInt()][];
        for (int i=0;i<scores.length;i++){
            System.out.println("请输入第"+(i+1)+"个班级学生人数：");
            /********** Begin **********/
             scores[i]=new double[scanner.nextInt()];

            /********** End **********/
            for (int j=0;j<scores[i].length;j++){
                System.out.println("请输入本班第"+(j+1)+"个学生的Java成绩：");
                /********** Begin **********/
                   scores[i][j]=scanner.nextDouble();

                /********** End **********/
            }
        }
        /********** Begin **********/
          double max = scores[0][0];
          double sum = 0;
          double avg = 0;
          int count=0;
        for (int i = 0; i < scores.length; i++) {
            for (int j = 0; j < scores[i].length; j++) {
                if(scores[i][j] > max) {
                    max = scores[i][j];
                }
                sum+=scores[i][j];
                count++;
            }
        }
          avg=sum/count;


        /********** End **********/
        System.out.println("最高分是：" + max);
        System.out.println("平均成绩是：" + avg);//输出每个元素的平均数
    }
}